#ifndef _SWAP_H_
#define _SWAP_H_
#include <stddef.h>
#include <inttypes.h>
#include <bitmap.h>
#include "devices/block.h"
#include "threads/thread.h"
#include "threads/vaddr.h"
#include "vm/frame.h"

#define MAX_SWAP_DISK_SECTOR (4096 * 1024) / BLOCK_SECTOR_SIZE

struct bitmap *swap_bitmap; 
struct list swap_list;
struct block *swap_block;

struct swap_entry{
  size_t start_sector;
  void * upage;
  tid_t holder_tid;
  struct list_elem swap_elem;
};
  
void swap_init(void);
void swap_out(void * upage,void * buffer); 
void swap_in(void * upage);

void block_read_page(struct block *block,size_t start_sector, void *buffer);
void block_write_page(struct block *block,size_t start_sector, void *buffer);

#endif

